<?php
namespace app\home\controller;

use app\BaseController;

class User extends BaseController {
    public function index()
    {
        # code...
        return $this->fetch();
    }
    public function login()
    {
        # code...
        if(request()->isPost()) {
            $data = [
                'accound' => $this->request->param('accound'),
                'usercard' => $this->request->param('usercard'),
                'password' => $this->request->param('password')
            ];
            $user = model('User')->login($data);
            if($user == 1) {
                return json(array('code' => 200, 'msg' => '登录成功'));
            }else{
                return json(array('code' => 198, 'msg' => '登录失败，可能是账号或者密码错误'));
            }
        }
    }
    public function my()
    {
        // print_r($menuattr);
        # code...
        // print_r(UserModel::get(1)->find());
        
    }
}